<div class="column-content-box" style="margin:0;">
    <div class="content-box content-box-header ui-corner-all">
        <div class="ui-state-default ui-corner-top ui-box-header">
            <span class="ui-icon float-left ui-icon-notice"></span>
            <?php echo Yii::t('DadminModule.msg', 'fields_required'); ?>
        </div>

        <div class="content-box-wrapper">
            <?php
            $form = $this->beginWidget('CActiveForm', array(
                'id'                   => 'menu-form',
                'enableAjaxValidation' => false,
                'focus'                => array($model, 'title'),
                'errorMessageCssClass' => 'error',
                'htmlOptions'          => array(
                    'class' => 'form',
                ),
            ));
            ?>
            <ul>
                <li>
                    <?php echo $form->labelEx($model, 'parent_id', array('class' => 'desc')); ?>
                    <div>
                        <?php
                        $data = $model->getMenu();
                        $this->widget('ArrayToDropDownList', array(
                            'model'       => $model,
                            'attribute'   => 'parent_id',
                            'data'        => $data,
                            'selected'    => $model->parent_id,
                            'disableItem' => $model->id,
                            'htmlOptions' => array(
                                'style'    => 'float: left; width: 200px;',
                                'tabindex' => '1',
                            ),
                        ));

                        //activated_flag
                        echo $form->checkbox($model, 'activated_flag', array(
                            'class' => 'checkbox',
                            'style' => 'float:left; margin: 8px 5px 0 5px;',
                        ));
                        echo CHtml::label($model->getAttributeLabel('activated_flag'),
                            'DMenu_activated_flag', array(
                                'class'    => 'desc',
                                'style'    => 'display: inline-block; margin-top:7px;',
                                'tabindex' => '2',
                            )
                        );
                        ?>
                    </div>
                </li>

                <li>
                    <?php echo $form->labelEx($model, 'title', array('class' => 'desc')); ?>
                    <div>
                        <?php
                        echo $form->textField($model, 'title', array(
                            'class'    => 'text full',
                            'tabindex' => '3',
                        ));
                        echo $form->error($model, 'title');
                        ?>
                    </div>
                </li>

                <li>
                    <?php
                    echo $form->labelEx($model, 'link', array(
                        'class' => 'desc',
                        'style' => 'float: left;',
                    ));
                    echo CHtml::link('(?)', 'javascript:void(0)', array(
                        'title' => Yii::t('DadminModule.app', 'link_helper'),
                        'id'    => 'assign-link',
                        'class' => 'link_strong',
                        'style' => 'float: left; margin-left: 10px;'
                    ));
                    ?>
                    <div>
                        <?php
                        echo $form->textField($model, 'link', array(
                            'class'    => 'text full',
                            'tabindex' => '4',
                        ));
                        echo $form->error($model, 'link');
                        ?>
                    </div>
                </li>

                <li style="text-align: center;">
                    <?php
                    $label = Yii::t('DadminModule.app', 'save');
                    echo CHtml::submitButton($label, array(
                        'class'    => 'ui-state-default ui-corner-all ui-button',
                        'tabindex' => '5',
                    ));

                    $label = Yii::t('DadminModule.app', 'reset');
                    echo CHtml::button($label, array(
                        'id'       => 'btn-reset',
                        'class'    => 'ui-state-default ui-corner-all ui-button',
                        'style'    => 'margin:0 10px;',
                        'tabindex' => '6',
                    ));

                    $label = Yii::t('DadminModule.app', 'cancel');
                    echo CHtml::button($label, array(
                        'id'       => 'btn-cancel',
                        'class'    => 'ui-state-default ui-corner-all ui-button',
                        'tabindex' => '7',
                    ));
                    ?>
                </li>
                <?php $this->endWidget(); ?>
            </ul>
        </div>
    </div>
</div>

<div id="digQuestion" class="display_none" style="font-size: 1.5em;">
    <ul>
        <li>
            <a href="javascript:void(0)" onClick="assignLink(1)">Thông tin chung</a>
        </li>

        <li>
            <a href="javascript:void(0)" onClick="assignLink(2)">Phân mục tin tức</a>
        </li>

        <li>
            <a href="javascript:void(0)" onClick="assignLink(3)">Góc ảnh</a>
        </li>
    </ul>
</div>

<script type="text/javascript">
$('#btn-cancel').click(function() {
    parent.$('#dialogForm').dialog('close');
});

$('#btn-reset').click(function() {
    window.location.href = window.location.href;
});

function assignLink(opt) {
    $('#digQuestion').dialog('close');
    parent.$('#dialogForm').data('option', opt).trigger('openDialogLinks');
}

$('#assign-link').click(function() {
    $('#digQuestion').dialog({
        title: '<?php echo Yii::t('DadminModule.app', 'link_helper') ?>',
        modal: true,
        resizable: false
    });
});
</script>